import java.util.Arrays;
import java.util.HashMap;

public class Solution {
    public static void main(String[] args) {

    }

    /**
     * 删除重复元素
     *
     * @param array int整型一维数组
     * @return int整型一维数组
     */
    public static int[] removeDuplicate(int[] array) {
        // write code here
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < array.length; i++) {
            map.put(array[i], i);
        }
        int[] res = new int[map.size()];
        int index = 0;
        for (int i = 0; i < array.length; i++) {
            if (map.get(array[i]) == i) {
                res[index++] = array[i];
            }
        }
        return res;
    }
}
